package com.fbinggun.fbinggunutil.price;


import com.fbinggun.fbinggunutil.API.PluginUtil;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;

/**
 * 游戏币价格
 */
public class MoneyPrice implements IPrice{
    double price;
    public MoneyPrice(ConfigurationSection config) {
        this.price=config.getDouble("Price");
    }

    @Override
    public PriceType getType() {
        return PriceType.Money;
    }

    @Override
    public boolean has(Player player) {
       return PluginUtil.getEco().has(player,getPrice());
    }

    @Override
    public boolean take(Player player) {
        PluginUtil.getEco().withdrawPlayer(player,getPrice());
        return false;
    }


    public double getPrice() {
        return price;
    }
}
